home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 June
/
Macworld (1999-06).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop2.0.sea
/
MacZoop2.0
/
Required Classes
/
ZGrafState.cp
< prev
next >
Wrap
Text File
|
1998-06-11
|
1KB
|
67 lines
/*************************************************************************************************
*
*
* MacZoop - "the framework for the rest of us"
*
*
*
* ZGrafState.cp -- a simple object for saving and restoring grafport state
*
*
* © 1997, Graham Cox
*
*
*
*************************************************************************************************/
#include "ZGrafState.h"
#include <QDOffscreen.h>
ZGrafState::ZGrafState()
{
clip = NewRgn();
Record();
}
ZGrafState::~ZGrafState()
{
Restore();
DisposeRgn( clip );
}
void ZGrafState::Record()
{
GetGWorld( &port, &dev );
GetClip( clip );
GetPenState( &pen );
GetBackColor( &back );
GetForeColor( &fore );
font = port->txFont;
fSize = port->txSize;
fStyle = port->txFace;
fMode = port->txMode;
}
void ZGrafState::Restore()
{
SetGWorld( port, dev );
SetClip( clip );
SetPenState( &pen );
RGBForeColor( &fore );
RGBBackColor( &back );
TextFont( font );
TextSize( fSize );
TextFace( fStyle );
TextMode( fMode );
}